package com.thoughtservice.jspdoc.export.argouml;

/*
 * The contents of this file are subject to the Mozilla Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code is "JSP Documentation Generator Project".
 *
 */

import com.thoughtservice.jspdoc.JSPPage;
import com.thoughtservice.jspdoc.RE;


/**
 * Stores graph related information for ArgoUML PGML file (like x-coordinates etc.)
 *
 * @author Jochen Luell (jochen@luell.com)
 */
public class GroupElement {
    
    private int xcoord;
    private int ycoord;
    private String jspName;
    private String groupName;
    private int level;
    private int width;
    private int height;
    private int linkTypeTo;
    private int linkTypeFrom;
    private String description;
    private String xmiName;
    private JSPPage jspPage;

    /**
     * Constructor
     *
     */
    public GroupElement() {
    }

    /**
     * X-coordinates setter method.
     *
     * @param x int X-Coordinate
     */
    public void setXcoord(int x) {
        this.xcoord = x;
    }

    /**
     * X-coordinates getter method.
     *
     * @return int X-Coordinate
     */
    public int getXcoord() {
        return xcoord;
    }

    /**
     * Y-coordinates setter method.
     *
     * @param y int Y-Coordinate
     */
    public void setYcoord(int y) {
        this.ycoord = y;
    }

    /**
     * Y-coordinates getter method.
     *
     * @return int Y-Coordinate
     */
    public int getYcoord() {
        return ycoord;
    }

    /**
     * Level setter method.
     *
     * @param level int Directory Level
     */
    public void setLevel(int level) {
        this.level = level;
    }

    /**
     * Level getter method.
     *
     * @return int Directory Level
     */
    public int getLevel() {
        return level;
    }
    
    /**
     * LinkTypeTo setter method.
     *
     * @param type link type to
     */
    public void setLinkTypeTo(int type) {
        this.linkTypeTo = type;
    }

    /**
     * LinkTypeTo getter method.
     *
     * @return link type to
     */
    public int getLinkTypeTo() {
        return linkTypeTo;
    }

    /**
     * LinkTypeFrom setter method.
     *
     * @param type link type to
     */
    public void setLinkTypeFrom(int type) {
        this.linkTypeFrom = type;
    }

    /**
     * LinkTypeFrom getter method.
     *
     * @return link type to
     */
    public int getLinkTypeFrom() {
        return linkTypeFrom;
    }

    /**
     * Width setter method.
     *
     * @param width int Width of graph element
     */
    public void setWidth(int width) {
        this.width = width;
    }

    /**
     * Width getter method.
     *
     * @return int Width of graph element
     */
    public int getWidth() {
        return width;
    }
    
    /**
     * Height setter method.
     *
     * @param height int Height of graph element
     */
    public void setHeight(int height) {
        this.height = height;
    }

    /**
     * Height getter method.
     *
     * @return height int Height of graph element
     */
    public int getHeight() {
        return height;
    }

    /**
     * JSP name setter method.
     *
     * @param name java.lang.String Name of JSP page (with "/")
     */
    public void setJspName(String name) {
        this.jspName = name;
    }

    /**
     * JSP name getter method.
     *
     * @param java.lang.String Name of JSP page (with "/")
     */
    public String getJspName() {
        return jspName;
    }
    
    /**
     * JSP page setter method.
     *
     * @param page ca.yourdecor.jspdoc.JSPPage JSPPage Object
     */
    public void setJspPage(JSPPage page) {
        this.jspPage = page;
    }

    /**
     * JSP page getter method.
     *
     * @return ca.yourdecor.jspdoc.JSPPage JSPPage Object
     */
    public JSPPage getJspPage() {
        return jspPage;
    }

    /**
     * Xmi-Name setter method.
     *
     * @param name java.lang.String Group name within XMI page
     */
    public void setXmiName(String name) {
        this.xmiName = name;
    }

    /**
     * Xmi-Name getter method.
     *
     * @return java.lang.String Group name within XMI page
     */
    public String getXmiName() {
        return xmiName;
    }

    /**
     * PMGL group name setter method.
     *
     * @param name java.lang.String Group name within XMI page
     */
    public void setGroupName(String name) {
        this.groupName = name;
    }

    /**
     * PMGL group name getter method.
     *
     * @param java.lang.String Group name within XMI page
     */
    public String getGroupName() {
        return groupName;
    }

    /**
     * Description setter method.
     * Deletes all HTML Tags and unnecessary spaces.
     *
     * @param description java.lang.String Group name within XMI page
     */
    public void setDescription(String description) {
	if(description == null) {
		description = "";
		
	}
	else {
	  try {
	     description = description.trim();

	     RE re;

	     // Remove HTML tags
	     re = new RE("<.*?>");
             description = re.subst(description, "");

	     // Remove additional spaces
	     re = new RE("[:space:][:space:]+");
             description = re.subst(description, " ");
          }
  	  catch(Exception e) {
	  	e.printStackTrace();
	  }
	}
	
        this.description = description;
    }
    
    /**
     * Description getter method.
     *
     * @return java.lang.String Group name within XMI page
     */
    public String getDescription() {
        return description;
    }
}
    
    
    
    
